/*
** basics3.c for my_printf in /home/nadali_t//local/svn/tek2ed/my_printf
** 
** Made by thomas nadalie
** Login   <nadali_t@epitech.net>
** 
** Started on  Sun Nov 18 16:33:16 2012 thomas nadalie
** Last update Sun Nov 18 16:33:18 2012 thomas nadalie
*/

#include	"my.h"

int		my_getnbr(char *str)
{
  int		i;
  int		res;
  int		minus;

  i = 0;
  res = 0;
  minus = 0;
  while ((str[i] == '+') || (str[i] == '-'))
    {
      minus++;
      i++;
    }
  while ((str[i] >= '0') && (str[i] <= '9') && (str[i] != '\0'))
    {
      res = res * 10;
      res = res + str[i] - '0';
      i++;
    }
  if (minus % 2)
    res = -res;
  return (res);
}

